﻿using UnityEngine;
using System.Collections;

public class CEAttribute
{
	/// <summary>
	/// 查看目标的某个位置上是否有Tag标记
	/// </summary>
	public static bool HasAttribute (int _target, int _index)
	{
		return (_target & (1 << _index)) != 0;
	}

	/// <summary>
	/// 在目标的某个位置上设置标记
	/// </summary>
	public static void SetAttribute (ref int _target, int _index)
	{
		if (!HasAttribute (_target, _index)) {
			_target |= (1 << _index);
		}
	}

	/// <summary>
	/// 抹除目标某个位置上的标记
	/// </summary>
	public static void RemoveAttribute (ref int _target, int _index)
	{
		if (HasAttribute (_target, _index)) {
			_target &= ~(1 << _index);
		}
	}

}
